#pragma once

struct LiquidQuad
{
	Vertex3FC m_vertices[4];
};

#pragma pack(1)

#define BLOCKSIZE (CHUNKSIZE / 8.0f)

struct LiquidHeader
{
	ui32 ofsInformation;
	ui32 nLayers;
	ui32 renderMask;
};

struct LiquidInformation
{
	ui16 LiquidType;
	ui16 flags;
	float heightLevel1;
	float heightLevel2;
	ui8 xOffset;
	ui8 yOffset;
	ui8 width;
	ui8 height;
	ui32 unk;
	ui32 heightmap;
};

#pragma pack()

class LiquidHandler
{
	std::vector<Vertex3FC> m_liquids;
	void LoadLayer(LiquidInformation& info, ui32& baseOffset, ui8* flags, Vertex2F& chunkBase);
	CMpqFile* m_file;
public:
	LiquidHandler(CMpqFile* file, ui32 ofsMH2O, Vertex2F chunkBase);
	void Render();
};